package com.rq.adapter;

import android.view.View;

import com.rq.rvlibrary.BaseAdapter;
import com.rq.rvlibrary.BaseViewHolder;
import com.rq.rvlibrary.EasyViewHolder;
import com.rq.rvlibrary.NestingViewHolder;
import com.rq.rvlibrary.RecyclerUtil;

import java.util.List;

public class DRVH2 extends NestingViewHolder {
    public DRVH2(View itemView) {
        super(itemView);
    }

    @Override
    public int inflateLayoutId() {
        return R.layout.item_parent;
    }

    @Override
    protected void fillChildData(EasyViewHolder holder, int position, Object childBean, int pPostion) {
        super.fillChildData(holder, position, childBean, pPostion);
//        DebugData item = (DebugData) childBean;
//        holder.setItemText(R.id.text_time, item.time);
//        holder.setItemText(R.id.text_ml, item.num);

//        String item = (String) childBean;
//        holder.setItemText(R.id.txt, item);
        holder.setItemText(R.id.txt, pPostion + ":" + childBean);
    }

    @Override
    protected void fillParentData(BaseViewHolder holder, BaseAdapter parentAdapter, int position, Object parentBean, BaseAdapter childAdapter, boolean showChild) {
        super.fillParentData(holder, parentAdapter, position, parentBean, childAdapter, showChild);
        MultilevelData pItem = (MultilevelData) parentBean;
        holder.setItemText(R.id.textView7, pItem.outData);
    }

    @Override
    protected List getChildData(Object parentBean, int position) {
//        return (List) parentBean;
        return ((MultilevelData) parentBean).childData;
    }

    @Override
    protected RecyclerUtil getChildRecyclerUtil(BaseAdapter adapter) {
        return new RecyclerUtil(adapter).row(2);
    }

    @Override
    protected int getChildLayoutId() {
        return R.layout.item_green;
    }

    @Override
    protected int getChildRecyclerId() {
        return R.id.recycler_inner;
    }
}
